package ex_innerclass;

import ex_innerclass.InnerClass;

public class InnerClassExam {
	public static void main(String[] args) {
		System.out.println("--------정적 중첩 클래스--------");
		StaticNestedClass pride = new StaticNestedClass("프라이드", 2005, "파랑");
		pride.outInfo();
		
		StaticNestedClass.CarName grandeur = new StaticNestedClass.CarName("그랜다이저", 2009);
		System.out.printf("모델 : %s, 년식 : %d\n", grandeur.model, grandeur.year);

		System.out.println("--------이너 클래스--------");
		InnerClass k5 = new InnerClass("k5", 2010, "하양");
		k5.outInfo();
		k5.carName.outColor();
		
		//Outer.Inner 변수명 = 외부객체.new Inner(생성자 인수);
		InnerClass.CarName k52 = k5.new CarName("k5", 2011);

		System.out.println("--------로컬 이너 클래스--------");
		class LocalInnerClassCar {
			void run() {
				System.out.println("부릉부");
			}
		}
		
		LocalInnerClassCar forte = new LocalInnerClassCar();
		forte.run();
		
		class Truck extends LocalInnerClass {

			@Override
			void run() {
				System.out.println("우당탕 쿵");
			}
			
		}
		
		Truck porter = new Truck();
		porter.run();

		System.out.println("--------익명 클래스--------");
		//Super 객체명 = new Super() {
		//	메서드 재정의
		//};
		AnonymousInnerClass porter2 = new AnonymousInnerClass() {
			void run() {
				System.out.println("우당탕 쿵탕");
			}
		};
		porter2.run();
		
		AnonymousInnerInterface damas = new AnonymousInnerInterface() {

			@Override
			public void run() {
				System.out.println("우당탕 쿵탕 쿵탕");
			}
			
		};
		
		damas.run();
	}

}
